package com.api.rocky.app;

import org.json.JSONArray;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

import com.api.rocky.R;
import com.api.rocky.Data.Global;
import com.api.rocky.Util.Util;

public class AddFirentActivity extends Activity {
	Button but_back, but_search;

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_add_firent);
		
		final EditText usernameEditText = (EditText) this.findViewById(R.id.friend_username);
		
		but_back = (Button) this.findViewById(R.id.back);

		but_back.setOnClickListener(new Button.OnClickListener() {
			public void onClick(View arg0) {
				android.os.Process.killProcess(android.os.Process.myPid());
			}
		});

		but_search = (Button) findViewById(R.id.search);
		but_search.setOnClickListener(new Button.OnClickListener() {
			public void onClick(View arg0) {
				JSONArray jsa = new JSONArray();
				jsa.put(1);
				jsa.put(usernameEditText.getText().toString());
				Util.SendMessageToServer(Global.client, jsa.toString());
				/*Intent intent = new Intent();
				intent.setClass(AddFirentActivity.this, UserActivity.class);
				startActivityForResult(intent, 1);*/
			}
		});
	}

}
